package com.csc.springcore.aop;

import java.util.Arrays;
import java.util.Date;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class EmployeeLog {

	@Around("execution(* com.csc.springcore.services.EmployeeService.*(..))")
	public void logAround(ProceedingJoinPoint joinPoint) throws Throwable {
		System.out.println("***** Start of Log ****");
		Date resultdate = new Date(System.currentTimeMillis());
		System.out.println("Call DateTime: " + resultdate);
		System.out
				.println("Method Name: " + joinPoint.getSignature().getName());
		System.out.println("Method Parameter(s): "
				+ Arrays.toString(joinPoint.getArgs()));
		System.out.println("Method's execution: ");
		
		joinPoint.proceed();
		
		System.out.println("**** End of Log ****");
//		joinPoint.proceed();
		System.out.println("\n\n");
	}
}